#include "prism_ir.h"
#include "../parsers/prism_ast.h"
#include "../parsers/prism_constants.h"
#include <vector>
#include <map>

void
parse_expression(prism_ast_expression const& expr) {
  visitor_type acc;
  expr.visit(acc);
}

void
parse_update(prism_ast_update const& update) {
  for(prism_ast_update::update_type::const_iterator it = update.begin();
      it != update.end();
      it++) {
        parse_expression(it->first);
        parse_expression(it->second);
        // TODO create a new expression out of the two parts
  }
}

void
parse_transition(prism_ast_update const& update) {
  for (vector<prism_ast_update>::const_iterator it = update.m_update.begin();
                it != update.m_update.end();
                it++) {
    parse_expression(it->first);
    parse_update(it->second);
  }
}

void
parse_transition(prism_ast_transition const& transition) {
  parse_expression(transition.m_from);
  for (vector<prism_ast_transition>::const_iterator it = m_transition.m_to.begin();
                it!= m_transition.m_to.end(),
                it++) {
    parse_update(*it);
  }
}

void
parse_module(prism_ast_module const& module) {
  for (vector<prism_ast_transition>::const_iterator it = prism_ast_module.m_transitions.begin(), 
                it != prism_ast_module.m_transitions.end(), it++) {
     parse_transition(*it);
  }
}

void
parse_program(prism_ast_program const& prog) {
  for (vector<prism_ast_module>::const_iterator it = prism_ast_program.m_modules.begin(), 
                it != prism_ast_program.m_modules.end(), it++) {
     parse_module(*it);
  }
}

prism_ir::prism_ir(bdd_manager const& manager, prism_ast_program const& program) {
  parse_program(program);
}
